package com.xiaolin.ssosystem.config;

import com.xiaolin.ssosystem.interceptor.SSOInterceptor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * @author xiaolin
 * @description 描述
 * @since 2024/10/17
 */
@Configuration
public class WebConfig implements WebMvcConfigurer {

    @Autowired
    private SSOInterceptor ssoInterceptor;

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(ssoInterceptor)
                .addPathPatterns("/**") // 拦截所有请求
                .excludePathPatterns("/ssoAuth/login", "/ssoAuth/getCode"); //排除无需认证的请求
    }
}
